home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
dskut
/
2m21src.zip
/
2MFBOTDD.ASM
< prev
next >
Wrap
Assembly Source File
|
1994-05-31
|
4KB
|
101 lines
;┌───────────────────────────────────────────────────────────────────┐
;│ │
;│ 2MFBOTDD 2.1 - (C) Mayo 1994 Ciriaco García de Celis. │
;│ │
;│ FICHERO CON CODIGO ENSAMBLADOR LINKABLE CON 2MF.C │
;│ │
;│ Con código del sector de arranque para discos DD. │
;│ │
;└───────────────────────────────────────────────────────────────────┘
_DATA SEGMENT WORD PUBLIC 'DATA'
ASSUME CS:_DATA, DS:_DATA
PUBLIC _BootDDPrg, _BootDDPrgLong
_BootDDPrg: CLI
XOR AX,AX
MOV SS,AX
MOV SP,7C00h ; SS:SP inicializado
MOV AX,07C0h
PUSH AX
PUSH AX
POP DS
POP ES
MOV SI,0000h
MOV DI,0200h
MOV CX,0100h
CLD
REP MOVSW ; auto-reubicar este código
MOV AX,07E0h
PUSH AX
PUSH AX
PUSH AX
POP DS
POP ES
MOV BX,DS:[68] ; constante de reubicación
LEA AX,[BX+OFFSET boot_ini - OFFSET _BootDDPrg]
PUSH AX
RETF ; saltar a boot_ini reubicado
boot_ini: STI
MOV BX,DS:[68] ; constante de reubicación
PUSH BX ; *
LEA BX,[BX+OFFSET info_txt - OFFSET _BootDDPrg]
CALL print
MOV AH,0
INT 16h ; esperar por una tecla
POP BX ; *
LEA BX,[BX+OFFSET crlf_txt - OFFSET _BootDDPrg]
CALL print
XOR AX,AX
MOV ES,AX
MOV BX,7C00h ; ES:BX = 0000:7C00
MOV AX,0201h ; leer un sector
MOV CX,0001h ; el sector 1 del cilindro 0
MOV DX,0080h ; y cabezal 0 del disco duro
PUSH ES
PUSH BX
INT 13h ; cargar tabla de particiones
JNC rd_ok
CMP AH,11h ; ¿error ECC corregido?
JNE err_boot
rd_ok: CMP WORD PTR ES:[7DFEh],0AA55h
JNE err_boot
XOR AX,AX
MOV DS,AX
RETF ; ejecutar tabla de particiones
err_boot: MOV BX,DS:[68]
LEA BX,[BX+OFFSET noboot_txt - OFFSET _BootDDPrg]
CALL print
MOV AX,40h
MOV DS,AX
MOV WORD PTR DS:[72h],1234h ; evitar chequeo memoria
MOV AH,0
INT 16h ; esperar tecla
DB 0EAh
DW 0, 0FFFFh ; jmp ffff:0000
print: MOV AL,[BX]
AND AL,AL ; carácter 0: fin del mensaje
JNZ print_car
RET
print_car: PUSH BX
MOV AH,0Eh
MOV BX,7
INT 10h ; imprimir carácter
POP BX
INC BX
JMP print
info_txt DB 13,10,"2M 2.1",13,10
DB " - Disquete DD: Pulsa una tecla para botar del disco duro...",13,10
DB " - DD diskette: Press any key to boot from your hard disk...",0
noboot_txt DB " ¡Error!: Pulsa una tecla - Press any key...",0
crlf_txt DB 13,10,10,0
_BootDDPrgLong DW $-OFFSET _BootDDPrg
_DATA ENDS
END